<?php
include_once($config['paths']['base'] . 'resources/api/classes/xml2json.php');
include_once($config['paths']['base'] . 'resources/api/classes/misc.php');
include_once($config['paths']['base'] . 'resources/api/classes/functions.php');
include_once($config['paths']['base'] . 'resources/api/classes/class.projects.php');
include_once($config['paths']['base'] . 'resources/api/classes/class.re-classify.php');
include_once($config['paths']['base'] . 'resources/api/classes/class.MysqliDatabase.php');

Class Classify {

	public  $log, $error, $db;

	function __construct() {
		global $config;
		$this->load();

		$this->project = new Projects;
		$this->reclassify = new ReClassify;

		$this->project->db = &$this->db;
		$this->reclassify->db = &$this->db;
	}

	function load() {
		Global $config;
		$connection_string="server={$config['db']['host']}; database={$config['db']['name']}; username={$config['db']['user']}; password={$config['db']['pass']};";
		$this->db = new MysqliDatabase($connection_string);
		return( true );
	}

	function getError($errorCode) {
		$ar = array(
			  101 => 'Zip File does not exist'
			, 102 => 'Failed to Open Zip File.'
			, 103 => 'Core File Could Not Be Extracted.'
			, 104 => 'This is an invalid project code or this project has been removed.'
			, 105 => 'Project Not Loaded.'
			, 106 => 'Incorrect project Status.'
			, 107 => 'Either primary Authority or Secondary Authority should be present'
			, 108 => 'Remote File Could Not Be Downloaded.'
			, 109 => 'Meta File Could Not Be Extracted.'
			, 110 => 'Project Not Currently Created.'
			,	111 => 'Too many rows for this software. Max allowed rows is 100,000.'
		);
		return $ar[$errorCode];
	}
}
?>